﻿//using System;
//using System.Collections.Generic;
//using System.Text;
//using DCRF.Common.Core;
//using DCRF.Common.Primitive;
//using System.Windows.Forms;
//using System.Collections;
//using DCRF.Common.Interface;
//using DCRF.Common.Attributes;

//namespace DCRF.BaseBlocks.Commander
//{
//    [BlockId("QuickWatchBlock")]
//    [BlockConnector("Container", typeof(Control))]
//    [BlockConnector("GlobalState", typeof(Hashtable))]
    
//    public class QuickWatchBlock: BlockBase
//    {
//        private sliver.Windows.Forms.StateBrowser browser = null;


//        public QuickWatchBlock(Guid id, IContainerBlockWeb parent)
//            : base(id, parent)
//        {
//        }

//        //public override BlockInfo BlockInfo
//        //{
//        //    get
//        //    {
//        //        BlockInfo result = new BlockInfo();

//        //        //result.BlockID = CID.New("QuickWatchBlock");
//        //        return result;
//        //    }
//        //}

//        public override void InitBlock()
//        {
//            //CreateConnector("Container");
//            //CreateConnector("GlobalState");
//        }


//        [BlockService]
//        public void BindToUI()
//        {
//            browser = new sliver.Windows.Forms.StateBrowser();

//            Control container = Connectors["Container"].Value as Control;
//            Hashtable gs = Connectors["GlobalState"].Value as Hashtable;

//            container.Invoke(new MethodInvoker(delegate()
//            {
//                container.Controls.Add(browser);
//                browser.Dock = DockStyle.Fill;
//                browser.ObjectToBrowse = gs;
//            }));
//        }

//        [BlockService]
//        public void AddObject(string key, object obj)
//        {
//            Control container = Connectors["Container"].Value as Control;
//            Hashtable gs = Connectors["GlobalState"].Value as Hashtable;
//            gs.Add(key, obj);

//            container.Invoke(new MethodInvoker(delegate()
//            {
//                browser.ObjectToBrowse = gs;
//            }));
//        }

//        [BlockService]
//        public void RemoveObject(string key)
//        {
//            Control container = Connectors["Container"].Value as Control;
//            Hashtable gs = Connectors["GlobalState"].Value as Hashtable;
//            gs.Remove(key);

//            container.Invoke(new MethodInvoker(delegate()
//            {
//                browser.ObjectToBrowse = gs;
//            }));
//        }

//        [BlockService]
//        public void Refresh()
//        {
//            Control container = Connectors["Container"].Value as Control;

//            container.Invoke(new MethodInvoker(delegate()
//            {
//                browser.ObjectToBrowse = browser.ObjectToBrowse;
//            }));
//        }
//    }
//}
